package com.aaa.member.controller;

import com.aaa.member.entity.IntegrationHistory;
import com.aaa.member.service.IntegrationHistoryService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (IntegrationHistory)表控制层
 *
 * @author chenhao
 * @since 2020-11-19 17:16:00
 */
@RestController
@RequestMapping("integrationHistory")
public class IntegrationHistoryController {
    /**
     * 服务对象
     */
    @Resource
    private IntegrationHistoryService integrationHistoryService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public IntegrationHistory selectOne(Long id) {
        return this.integrationHistoryService.queryById (id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @GetMapping("selectAll")
    public List<IntegrationHistory> queryAllByLimit(int offset, int limit) {
        return this.integrationHistoryService.queryAllByLimit (offset, limit);
    }

    /**
     * 新增数据
     *
     * @param integrationHistory 实例对象
     * @return 实例对象
     */
    @PostMapping("insert")
    public IntegrationHistory insert(IntegrationHistory integrationHistory) {
        this.integrationHistoryService.insert (integrationHistory);
        return integrationHistory;
    }

    /**
     * 修改数据
     *
     * @param integrationHistory 实例对象
     * @return 实例对象
     */
    @PutMapping("update")
    public IntegrationHistory update(IntegrationHistory integrationHistory) {
        return this.integrationHistoryService.update (integrationHistory);
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @DeleteMapping("deleteById")
    public boolean deleteById(Long id) {
        return this.integrationHistoryService.deleteById (id);
    }
}